import logging
class TUtils:
    @staticmethod
    def getLogger( logName , logFile):
        logger = logging.getLogger(logName)
        try:
            logger.setLevel(level = logging.DEBUG)
            handler = logging.FileHandler(logFile)
            handler.setLevel(logging.DEBUG)
            formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
            handler.setFormatter(formatter)
        except Exception as er:
            print(er)
        return  logger
    @staticmethod
    def getPointProtopol(self , measurement , tags , fields , tmNs):
        res =""
        try:
            tagData= ",".join([ x+'='+tags[x] for x in list(tags.keys())])
            fieldData= ",".join([ x+'='+str(fields[x]) for x in list(fields.keys())])
            res =f'{measurement},{tagData} {fieldData} {str(tmNs)}'
        except Exception as er:
            print(er)
        return  res